﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CoreModels;

namespace DeviceAutomationService.Models
{
    public class AutomationIdentifier
    {
        public string AutomationName { get; set; }
        public string ElementName { get; set; }
        public string DisplayedText { get; set; }

        public AutomationIdentifier()
        {
        }

        public AutomationIdentifier(string text, AutomationIdentification automationIdentification)
        {
            Fill(text, automationIdentification);
        }

        public void Fill(string text, AutomationIdentification automationIdentification)
        {
            AutomationName =
                automationIdentification.HasFlag(AutomationIdentification.TryAutomationName)
                    ? text
                    : null;

            ElementName =
                automationIdentification.HasFlag(AutomationIdentification.TryElementName)
                    ? text
                    : null;

            DisplayedText =
                automationIdentification.HasFlag(AutomationIdentification.TryDisplayedText)
                    ? text
                    : null;
        }
    }
}